Repository navigation
fix(cloudflare): 301 docs URLs removed by #383 and #1001 to their new pages - #1336
Conversation
…ge#1001 to their new pages Add 17 entries to GONE_PAGES so the old Overview / Refresh Token / Error Codes pages (merged into /docs/api by longbridge#383), the market endpoints moved by longbridge#1001, and the /docs/content/news category redirect instead of 404. resolveGone() carries the locale prefix and .md twin, covering 51 page URLs plus their markdown twins. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Per review, /docs/error-codes now 301s to /docs/api?page=error-codes, the address used by in-site error code links. resolveGone() accepts a target with its own query: page requests get the target query first and the incoming query appended; .md requests drop the target query and go to the markdown twin (/docs/api.md, which already contains the error code table), so they never become ?page=error-codes.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Reviewed, looks good to merge. One suggestion before merging:
Checked locally by calling Will merge once this is updated. 拉罐的 Claude 代发 |
…authentication view /docs/api without a query lands on Overview (resolvePage() defaults to overview). Both pages were merged into x-pages.authentication by longbridge#383, so point them at /docs/api?page=authentication, the same way error-codes goes to ?page=error-codes. The .md twins still go to /docs/api.md. Suggested in review by @twosugar. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Thanks, updated in 2b748fe (one commit on top, no force push): both now 301 to Re-ran
(all 32 combinations of these two paths pass; the rows above are a sample.) Target check in production:
赤拔的 Claude 代发 |
Summary
Two docs reorganisations left old URLs returning 404 with no redirect:
openapi.yamlx-pages, rendered at/docs/api).quote/pull/*andfundamental/{market,calendar}/*tomarket/*.Google Search Console (2026-10-20 ~ 11-17) still shows 6 of these URLs with 295 impressions (
/docs/how-to-access-apiavg. position 3.4,/docs/error-codes6.5). Developers following search results, AI tools or old links land on the 404 page.This PR adds 17 entries to the existing
GONE_PAGEStable infunctions/[[path]].ts(the #1317 mechanism).resolveGone()carries the locale prefix and the.mdtwin, so the 17 entries cover 51 page URLs (17 × en / zh-CN / zh-HK) plus their.mdtwins. One file. The only logic change is thatresolveGone()now accepts a target with its own query string (needed forerror-codes,how-to-access-apiandrefresh-token-api, see below); entries without a query behave exactly as before..md)/docs/how-to-access-api/docs/api?page=authentication(.md→/docs/api.md)x-pages.authenticationby #383/docs/refresh-token-api/docs/api?page=authentication(.md→/docs/api.md)x-pages.authenticationby #383/docs/error-codes/docs/api?page=error-codes(.md→/docs/api.md)x-pages.error-codesby #383; same address as in-site error code links (see below)/docs/quote/pull/trade-session/docs/market/trade-session/docs/quote/pull/trade-day/docs/market/trade-days/docs/quote/pull/market_temperature/docs/market/market-temperature/docs/quote/pull/history_market_temperature/docs/market/history-market-temperature/docs/fundamental/market/market-status/docs/market/market-status/docs/fundamental/market/unusual-items/docs/market/unusual-items/docs/fundamental/calendar/dividend-calendar/docs/market/calendar/dividend-calendar/docs/fundamental/calendar/earnings-calendar/docs/market/calendar/earnings-calendar/docs/fundamental/calendar/ipo-calendar/docs/market/calendar/ipo-calendar/docs/fundamental/calendar/macro-calendar/docs/market/calendar/macro-calendar/docs/fundamental/calendar/meeting-calendar/docs/market/calendar/meeting-calendar/docs/fundamental/calendar/merge-calendar/docs/market/calendar/merge-calendar/docs/fundamental/calendar/split-calendar/docs/market/calendar/split-calendar/docs/content/news/docs/content/news/newsnews/newsis in the sitemapTargets with a query (
error-codes,how-to-access-api,refresh-token-api)/docs/apiwithout a query lands on Overview (resolvePage()inpackages/api-reference/src/ApiReference.tsxdefaults tooverview), so these three go to the view that holds their content:/docs/error-codes→/docs/api?page=error-codes(the address in-site error code links use),/docs/how-to-access-apiand/docs/refresh-token-api→/docs/api?page=authentication(suggested in review).resolveGone()now splits a target into path and query:/docs/error-codes/docs/api?page=error-codes/zh-HK/docs/error-codes?x=1/zh-HK/docs/api?page=error-codes&x=1(target query first, incoming query appended)/zh-CN/docs/error-codes.md/zh-CN/docs/api.md/en/docs/error-codes.md?x=1/docs/api.md?x=1/docs/how-to-access-api/docs/api?page=authentication/zh-CN/docs/refresh-token-api?x=1/zh-CN/docs/api?page=authentication&x=1/zh-HK/docs/how-to-access-api.md/zh-HK/docs/api.mdFor
.mdrequests the.mdsuffix goes on the path and the target query is dropped, so it never becomes?page=error-codes.md.?page=only switches the view in the browser; the markdown twin/docs/api.mdis the whole API Reference and already contains the error code table and the authentication section (checked in production:/docs/api.md,/zh-CN/docs/api.md,/zh-HK/docs/api.mdare 200 and include403201andX-Api-Signature;/docs/api/error-codes(.md)is 404;/docs/api?page=authenticationis 200 in all 3 locales andauthenticationis anx-pagesid inopenapi.yaml). The incoming query is kept in both cases, as before.Verification (before merge)
.md) return 200;/docs/api?page=error-codesand/docs/api?page=authenticationare 200 in all 3 locales.onRequestlocally for each of the 17 paths × (root,/en,/zh-CN,/zh-HK) × (page,.md) × (no query,?a=1): 272/272 return 301 with the expectedLocation(/endropped, incoming query kept;error-codespages →?page=error-codes,how-to-access-api/refresh-token-apipages →?page=authentication, their.md→api.md). Re-run on 2b748fe after the review change: 272/272. Existing entries and current pages unaffected (us_etf_filesandus_etf_files.md?q=2still 301 as before,/docs/market/trade-session,/docs/api,/docs/content/news/newspass through).vitest run: 60/60 passed.tsc --noEmit --strictandoxlinton the file: clean. (prettier -creports two pre-existing long lines onmain, not in this diff.)CLAUDE.md.Post-deploy check
Request each of the 17 old paths in en, zh-CN and zh-HK once (51 URLs):
301,Locationmatching the table (zh-CN / zh-HK keep their prefix, en has none)Locationtarget returns200error-codes,how-to-access-api,refresh-token-apialso in.mdfor all 3 locales:error-codespage →…/docs/api?page=error-codes, the other two pages →…/docs/api?page=authentication, all.md→…/docs/api.mdSample:
curl -sI https://open.longbridge.com/docs/how-to-access-api→301,location: https://open.longbridge.com/docs/api?page=authentication.🤖 Generated with Claude Code